<html>
<head>
<script type="text/javascript" src="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/jquery.min.js">
		</script>
		<script type="text/javascript" src="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/bootstrap.min.js">
		</script>
		<script type="text/javascript" src="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/ace-extra.min.js">
		</script>
		<script type="text/javascript" src="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/ace.min.js">
		</script>
		<link rel="stylesheet" type="text/css" href="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="http://198.74.61.72/themes/preview/ace/assets/css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="http://sandbox.runjs.cn/uploads/rs/408/gjeegkdb/ace.min.css">
		
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://www.francescomalagrino.com/BootstrapPageGenerator/3/js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="http://www.francescomalagrino.com/BootstrapPageGenerator/3/js/jquery-ui"></script>
<link href="http://www.francescomalagrino.com/BootstrapPageGenerator/3/css/bootstrap-combined.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="http://www.francescomalagrino.com/BootstrapPageGenerator/3/js/bootstrap.min.js"></script>
  <#include "/base/head.html">

</head>
<body>
<script type="text/javascript">
		
			$(function() {
				init();

				var deleteUrl = "";

				$("#diseaseSearchSubmit").click(function() {
					refreshGrid();
				});
				//点击编辑用户
				$("#diseaseEdit").click(function() {
					
                    
					var selected = $("#diseaseGrid").datagrid('getSelected');
					if (selected == null) {
						alert("请先选择疾病");
						return;
					}

					$("#diseaseFormEdit").attr("action", $(this).attr("postUrl"));
					$('#diseaseFormDlg').dialog({
						"iconCls" : "icon-edit",
						"title" : "疾病修改"
					});
					$('#diseaseFormDlg').dialog('open');

					var params = new Object();
					params.id = selected.id;
					$("#disease_id").val(selected.id);
					console.log($("#disease_id").find(":input[name=id]"));
					BaseJs.setFormByUrl("#diseaseFormEdit", params);
				});
				//初始化页面
				function init() {
					$("#diseaseFormEdit").form('clear');
					$("#diseaseForm").form('clear');

					refreshGrid();
				}

				//根据form里面的信息获取并填充grid
				function refreshGrid() {
					BaseJs.formChangeGrid("#diseaseForm", "#diseaseGrid");
				}

				$("#diseaseAdd").click(function() {
					
					$("#diseaseFormEdit").form('clear');
					$("#diseaseFormEdit").attr("action", $(this).attr("postUrl"));
					$('#diseaseFormDlg').dialog({
						"iconCls" : "icon-add",
						"title" : "疾病新增"
					});
					 
					$("#disease_id").val("");
					$('#diseaseFormDlg').dialog('open');
				});

				$("#diseaseDelete").click(function() {
					
					var selected = $("#diseaseGrid").datagrid('getSelected');
					if (selected == null) {
						alert("请先选择疾病");
						return;
					}
					var params = new Object();
				    params.id = selected.id;
					BaseJs.ajax($(this).attr('postUrl'), params, function() {
						refreshGrid();
						alert("删除疾病成功");
					})

				});
				//修改的弹出框按提交
				$("#diseaseSubmitEdit").click(function() {
					BaseJs.submitForm("#diseaseFormEdit", function(rData) {
						//修改完重新查询
						$("#diseaseSearchSubmit").click();
						$('#diseaseFormDlg').dialog('close');
					});
				});
			});
	
		</script>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12">
			<div class="navbar">
				<div class="navbar-inner">
					<div class="container-fluid">
						<a class="btn btn-navbar" data-target=".navbar-responsive-collapse" data-toggle="collapse"></a> <a class="brand" href="#">宠物诊断</a>
						<ul class="nav pull-right">
							<li>
								<a>${user.nickname} 你好 </a>
							</li>
							<li class="divider-vertical">
							</li>
							<li>
								<a href="${contextPath}/login/ss">退出登录</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="row-fluid">
				<div class="span2">
					<div class="sidebar" id="sidebar">
			
			<!-- #sidebar-shortcuts -->
			
			<ul class="nav nav-list">
				<li class="active">
					<a href="index.html">
						<i class="icon-dashboard">
						</i>
						<span class="menu-text">
							主菜单 
						</span>
					</a>
				</li>
				
				
				
				<li>
					<a href="#" class="dropdown-toggle">
						<i class="icon-desktop">
						</i>
						<span class="menu-text">
							用户管理 
						</span>
						
						<b class="arrow icon-angle-down">
						</b>
					</a>
					
					<ul class="submenu">
						<li>
							<a href="/petdogexpert/web-cilent/management.html">
								<i class="icon-double-angle-right">
								</i>
								用户信息
							</a>
						</li>
						
						<li>
							<a href="/petdogexpert/web-cilent/NewFile.html">
								<i class="icon-double-angle-right">
								</i>
								宠物犬信息
							</a>
						</li>
						
						
						
						
						
						
						
						
					</ul>
				</li>
				
				<li>
					<a href="#" class="dropdown-toggle">
						<i class="icon-list">
						</i>
						<span class="menu-text">
							诊断模块 
						</span>
						
						<b class="arrow icon-angle-down">
						</b>
					</a>
					
					<ul class="submenu">
						<li>
							<a href="/petdogexpert/web-cilent/diagnosis.html>
								<i class="icon-double-angle-right">
								</i>
								疾病诊断
							</a>
						</li>
						
						<li>
							<a href="jqgrid.html">
								<i class="icon-double-angle-right">
								</i>
								疾病信息查询
							</a>
						</li>
					</ul>
				</li>
				
				
				
				
				
				
				<li>
					<a href="gallery.html">
						<i class="icon-picture">
						</i>
						<span class="menu-text">
							问题反馈
						</span>
					</a>
				</li>
				
			
				
				
			</ul>
			<!-- /.nav-list -->
			
			<div class="sidebar-collapse" id="sidebar-collapse">
				<i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right">
				</i>
			</div>
			
		</div>
		
				</div>
				<div class="span6">
			<div class="header">

			<h1 class="page-title">主菜单</h1>
			
				<ul class="breadcrumb" contenteditable="true" style="background-color:#FFFFFF;">
<li><a href="/petdogexpert/web-cilent/containhtml.html">主菜单</a> /</li>

							<a href="#">诊断模块</a> /
						
						 <class="active">
							疾病查询
</ul>

			

		</div>
		<form id="diseaseform" action="">
				<td>疾病名称:</td>
							<td><input class="easyui-textbox" type="text"
								name="name" /></td>
								<a id="diseaseSearchSubmit" href="javascript:void(0)"
					class="easyui-linkbutton mediumButton" oncilck=submitForm()>查询</a>
					</form>
					<table id="diseaseGrid" toolbar="#diseaseToolbar" class="easyui-datagrid"
				title="症状显示" style="width: 100%; height: 100%;"
				data-options="singleSelect:true,method:'post',fitColumns : true">
				<thead>
					<tr>
						<th data-options="field:'id',width:50,align:'center'">疾病ID</th>
						<th data-options="field:'name',width:100,align:'center'">疾病名</th>
						<th data-options="field:'description',width:100,align:'center'">描述</th>
						<th data-options="field:'crificality',width:100,align:'center'">严重程度</th>
						<th data-options="field:'solution',width:100,align:'center'">治疗方法</th>
						<th data-options="field:'disease-symptom',width:100,align:'center'">疾病-症状</th>
						
					<script>
						var lovRoleNameMapping = new Object();
						var lovUserStatusMapping = new Object();
						
						function updateRoleInfo(data, e) {

							if (data == 3 || data == 4) {
								return "<a class='setRoleInfo' roleId='"+data+"' userId='"+e.id+"' href='##' title='点击设置'>" + lovRoleNameMapping[data] + "</a>";
							} else {
								return lovRoleNameMapping[data];
							}
						}
						function formatUserStatus(data) {
							return lovUserStatusMapping[data];
						}
						

						$(function() {
							
							//initSelect();
							 
							function initSelect() {
								//初始化lovRoleNameMapping 用来显示select的列
								$("#diseaseForm_authority").combobox();
								var data = $("#diseaseForm_authority").combobox("getData");
								var textField = $("#diseaseForm_authority").combobox("options").textField;
								var valueField = $("#diseaseForm_authority").combobox("options").valueField;
								
								for(var i in data) {
									lovRoleNameMapping[data[i][valueField]] = data[i][textField];
								}
								
								//初始化状态
								var statusLov = '{'+ '${lovService.getLovListString("lov_user_status")}' +'}';
								var statusObj = JSON.parse(statusLov);
								data = statusObj.data;
								textField = statusObj.textField;
								valueField = statusObj.valueField;
								for(var i in data) {
									lovUserStatusMapping[data[i][valueField]] = data[i][textField];
								}
							}
							
							$(document).on('click', ".setRoleInfo", function() {

								var roleId = $(this).attr('roleId');
								var userId = $(this).attr('userId');
								var roleName = "";

								switch (roleId) {
								case '3':
									openUserExtendEdit('member', userId);
									break;
								case '4':
									openUserExtendEdit('doctor', userId);
									break;
								}

							});
							var userExtendEditDlg = new Object();

							function openUserExtendEdit(roleName, userId) {
								console.log(roleName+"  "+userId);
								if (!userExtendEditDlg[roleName]) {
									userExtendEditDlg[roleName] = $('#'+roleName+'EditDlgPanel').panel({
										href : '${contextPath}/user/' + roleName + '_edit.html',
										onLoad : function() {
											
											$("#" + roleName + "Id").val(userId);
											$("#" + roleName + "EditDlg").dialog('open');
										}
									});

								}

								$("#" + roleName + "Id").val(userId);
								$("#" + roleName + "EditDlg").dialog('open');
							}
							
						});
					</script>
				</thead>
			</table>
							</div>
					
				</div>
			
				
			</div>
		</div>
	</div>
</div>
</body>
</html>